//
//  LoginViewController.m
//  YJlandlord
//
//  Created by 文彬 on 2018/6/24.
//  Copyright © 2018年 文彬. All rights reserved.
//

#import "LoginViewController.h"
#import "LoginMiddleView.h"

@interface LoginViewController ()

@property (strong, nonatomic) LoginMiddleView *middleView;
@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self initPageControl];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)dealloc{
    NSLog(@"dealloc");
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (void)initPageControl{
    self.middleView.codeBtn.phoneNum = @"15101532374";
    
    UIImageView *imgView = [[UIImageView alloc]init];
    imgView.backgroundColor = RGBCOLOR(115, 115, 115);
    [self.view addSubview:imgView];
    [imgView makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.equalTo(@0);
       
    }];
    
    UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [closeBtn setBackgroundImage:[UIImage imageNamed:@"YXLInteractionVideoWindow_close"] forState:UIControlStateNormal];
    [self.view addSubview:closeBtn];
    [closeBtn makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(@(kStatusBarHeight));
        make.width.equalTo(@30);
        make.height.equalTo(@30);
    }];
    [closeBtn buttonClick:^{
        [self dismissViewControllerAnimated:YES completion:nil];
    }];
    
    UILabel *messlabel = [[UILabel alloc]init];
    messlabel.textColor = [UIColor whiteColor];
    messlabel.font = [UIFont boldSystemFontOfSize:25];
    messlabel.text = @"登录意居";
    [self.view addSubview:messlabel];
    [messlabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(@100);
        make.height.equalTo(@40);
        make.width.equalTo(@300);
    }];
    
    [self.view addSubview:self.middleView];
    [self.middleView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.height.equalTo(@240);
        make.centerY.equalTo(self.view.centerY);
    }];
    
    UILabel *messBottomlabel = [[UILabel alloc]init];
    messBottomlabel.textColor = [UIColor whiteColor];
    messBottomlabel.font = [UIFont systemFontOfSize:16];
    messBottomlabel.text = @"第三方登录";
    messBottomlabel.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:messBottomlabel];
    [messBottomlabel makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view.centerX);
        make.bottom.equalTo(@-100);
        make.height.equalTo(@40);
        make.width.equalTo(@300);
    }];
    
    UIButton *wxBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [wxBtn setBackgroundImage:[UIImage imageNamed:@"weixin_logo_large"] forState:UIControlStateNormal];
    [self.view addSubview:wxBtn];
    [wxBtn makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view.centerX).offset(-10);
        make.top.equalTo(messBottomlabel.bottom).offset(30);
        make.width.equalTo(@35);
        make.height.equalTo(@35);
    }];
    
    UIButton *alipayBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [alipayBtn setBackgroundImage:[UIImage imageNamed:@"zhifubao_"] forState:UIControlStateNormal];
    [self.view addSubview:alipayBtn];
    [alipayBtn makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.centerX).offset(10);
        make.top.equalTo(messBottomlabel.bottom).offset(30);
        make.width.equalTo(@35);
        make.height.equalTo(@35);
    }];

}

#pragma  mark getter
- (LoginMiddleView*)middleView{
    if (_middleView==nil) {
        _middleView = [[NSBundle mainBundle] loadNibNamed:@"LoginMiddleView" owner:nil options:nil][0];
    }
    return _middleView;
}

@end
